
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

static void dec2bin(int x, char *s)
{
     int i = 3;
     char buf[5] = {'0', '0', '0', '0', '\0'};
     assert(x >= 0 && x < 16);
     while (x){
	  buf[i--] = x % 2 + '0';
	  x /= 2;
     }
     strcpy(s, buf);
}

static void number_tab(void)
{
     int i;
     char s[16];

     putchar('\n');
     printf("Dec\tHex\tOct\tBin\n");
     for (i = 0; i < 16; i++){
	  printf("%d\t%-X\t%-.2o\t", i, i, i);
	  dec2bin(i, s);
	  printf("%s\n", s);
     }
}

int main()
{
  number_tab();
  return 0;
}
